<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script src="../lib/js/jquery.1.10.1.js"></script>
    <script type="text/javascript" src="../lib/js/common/base.js"></script>
    <!-- <script src="../lib/js/common/app.js"></script> -->
    <style>
        *{
            padding:0;
            margin:0;
            box-sizing:border-box;
        }
        html,body{
            box-sizing: border-box;
            font-size: 10px;
            width:100%;
            height:100%;
            background-color: #0c1e34;
        }
        .passwordBgc{
            margin-bottom: 0px;
        }
        
        .station_login_wrap{
            width: 36rem;
            margin: 0 auto;
            background-color: #fff;
            padding: 3rem;
            border-radius: 5px;
        }
        /*登录*/
        .station_login{
            background:url("../lib/img/login.jpg") no-repeat;
            background-size:cover;
        }
        .station_grid_login{
            width: 100%;    
            margin: -168px auto 0px;
            position: absolute;
            top: 50%;
        }
        .station_login_title{
            margin-bottom: 5rem;
            padding-left: 1rem
        }
        .station_login_title h1{
            font-size: 4.2rem;
            font-weight: normal;
            color: #fff;
            text-align: center;
        }


        .station_login_loginTit{
            width: 40rem;
            text-align: right;
            color: #fff;
            font-size: 1.7rem;
            margin-bottom:0.5rem;
            padding: 5rem;
        }
        .station_login_input{
            width: 30rem;
            height: 3.3rem;
            line-height: 3.3rem;
            margin-bottom: 2rem;
            border-radius: 0.5rem;
            background-color: rgba(255,255,255,0);
            border:1px solid #bbb;
            padding-left: 3rem;
            color: #bbb;
            box-sizing: border-box;
        }

        .countBgc{
            background: url("../lib/img/count.png") no-repeat 5px 5px;
            background-size:7%;
        }
        .passwordBgc{
            background: url("../lib/img/keyicon.png") no-repeat 5px 5px;
            background-size:7%;
        }
        .station_login_forget{
            text-align: center;
            width: 30rem;
            height: 1rem;
            line-height: 1rem;
        }
        .station_login_forget>a{
            color: #fff;
        }
        .station_login_wrap>button{
            width: 30rem;
            height: 3rem;
            /* margin-bottom: 2rem; */
            border-radius: 0.5rem;
            background-color: #0475B7;
            border: none;
            font-size: 2rem;
            color: #fff;
            box-sizing: border-box;
            cursor: pointer;
        }
        .login_tip{
                /* height: 0.5rem; */
            color: #f33b3b;
            text-align: right;
            line-height: 1rem;
            padding-right: 2rem;
            box-sizing: border-box;
            margin-bottom: 1rem;
            /* margin-top: 1rem; */
            width: 32rem;
        }
    </style>
</head>
<body class="station_login">
<div class="station_grid_login">
    <div class="station_login_title">
        <h1>欢迎来到北京站网格化管理平台！</h1>
    </div>
    <div class="station_login_wrap">
        <input class="station_login_input countBgc" name='user_name' type="text" placeholder="账号"/>
        <input class="station_login_input passwordBgc"  name="user_pass" type="password" placeholder="密码"/>
        <p class="login_tip"></p>
        <button  class="station_login_right_btn" type="submit">登录</button>
        
        <!-- <p class="station_login_forget"><a href="changePass.html">忘记密码？</a></p> -->
    </div>
    <!-- <div class="link_A">
        <a href="http://10.78.153.164:14136/download/chrome_forXP.exe">XP系统点此下载谷歌浏览器</a>
        <a href="http://10.78.153.164:14136/download/Chrome.exe">Win7及以上系统点此下载谷歌浏览器</a>
    </div> -->
</div>
<script>
$(function(){
    //验证账户
    /*
        $('input[name=user]').blur(function(){
            $forgetPassword.find(".inputtips").remove();

            //用户名验证
            if( $(this).is('input[name=userphon]') ){
                if( this.value=="" || ( this.value!="" &&!/^[1][2,3,4,5,6,7,8,9][0-9]{9}$/.test($(this).val())) ){
                    $forgetPassword.append('<span class="inputtips forget_password-tips">请输入至少11位的手机号.</span>').css('color','coral');
                }else{
                    $forgetPassword.append('<span class="inputtips forget_password-tips"></span>');
                }
            }
            //密码验证
            if( $(this).is('input[type=password]') ){
                if( this.value=="" || ( this.value!="" && !/[a-zA-Z]{1,5}[0-9]{2,5}$/.test(this.value)) ){
                    $forgetPassword.append('<span class="inputtips forget_password-tips">请以字母开头数字混合最少6位.</span>').css('color','coral');
                }else{
                    $forgetPassword.append('<span class="inputtips forget_password-tips"></span>');
                }
            }
        })
   */
    //提交(需要接口)
    $('.station_login_right_btn').on('click',function(){
            var user_name = $("input[name ='user_name']").val();
            var user_pass = $("input[name ='user_pass']").val();
            $.ajax({
                url:serverUrl.base+serverUrl.login,
                type:'post',
                data:{
                    user_account:user_name,
                    user_pwd:user_pass
                },
                dataType:"json",
                success:function(msg){
                    if(msg.code==0){
                        //storage('in',msg.data)
                        storageControl.setStorageS(msg.data)
                        // $.post(serverUrl.base+serverUrl.user+'user_done',{user_id:msg.data.user_id},function(res){
                        //     console.log('user_done',res.data)
                        // },'json')
                        // $.post(serverUrl.base+serverUrl.user+'user_intro',{user_id:msg.data.user_id},function(res){
                        //     console.log('user_intro',res.data)
                        // },'json')
                        var _powers = msg.data.power.split(',')
                        if(_powers.some(function(v){return v == '2'})){
                            window.location.href='./organization-base-depsetting.html';
                        }else{
                            alert('该帐号没有后台管理权限，请更换帐号登录')
                        }
                    }else if(msg.code==1){
                        $('.login_tip').text(msg.info)
                        console.log(msg.info);
                    }else if(msg.code ==2){
                        $('.login_tip').text(msg.info)
                    }

                }
            })
        })
    //提交勿删
    $("input[name=user_name]").keydown(function() {
        if (event.keyCode == "13") {
            $('.station_login_right_btn').click();
        }
    });
    $("input[name=user_pass]").keydown(function() {
        if (event.keyCode == "13") {
            $('.station_login_right_btn').click();
        }
    });
    $('body').loading('close')
})
</script>
</body>
</html>